import { isFunction } from "..";

/**
 * 生成size大小的数组
 */
export function map<T = unknown>(
  size: number,
  value: T | ((i: number, size: number) => T)
) {
  return Array(size)
    .fill(0)
    .map((_, i) => {
      return isFunction(value) ? value(i, size) : value;
    });
}
